package csdnpractice;

import java.util.Scanner;

public class Practice01 {

    public static void main(String[] args) {
        //给定一个字符串,判断该字符串中是否包含某个子串.如果包含,求出子串的所有出现位置.
        //如:"abcbcbabcb34bcbd"中,"bcb"子串的出现位置为: 1,7,12.字符串和子串均由用户输入
        Scanner scanner = new Scanner(System.in);
        System.out.println("字符串:");
        String str = scanner.nextLine();
        System.out.println("子串:");
        String str1 = scanner.nextLine();
        for (int i=0;i<str.length();){
            int num = str.indexOf(str1,i+1);
            System.out.println("num:"+num);
            i+=str1.length();
        }
    }
}
